package com.edu.demo.login.serviceImpl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

import com.edu.demo.login.dao.LoginDao;
import com.edu.demo.login.model.UserDomain;
import com.edu.demo.login.service.LoginService;
import com.edu.demo.login.service.SessionProvider;
import com.edu.demo.login.utlis.RequestUtils;

@Service
public class loginServiceImpl implements LoginService {

	

	@Autowired
	private LoginDao logondao;

	@Override
	public UserDomain login(UserDomain userDomain, HttpServletRequest request, HttpServletResponse response) {

		//int ssss = 1/0;
		// 加密
		String passwd = DigestUtils.md5DigestAsHex(userDomain.getPasswd().getBytes());
		userDomain.setPasswd(passwd);

		//查询出来返回的对象
		UserDomain userModel = logondao.login(userDomain);
        
		return userModel;
	}

	
}
